<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match='nbsp' name='nbsp'>
<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>
</xsl:template>

<xsl:include href='../xsl.include.main.xsl'/>

<xsl:template match="galleryEntry[@activityid &gt; 0]">

		<div class="galleryTitle" style="padding-bottom:5px;"><b><xsl:value-of select="@title"/></b></div>
		<div class="galleryAuthor" style="padding-left:10px; padding-bottom:5px;">
			<span style="color: #cc0000; font-weight:bold;"><xsl:value-of select="@placeName"/></span>
		</div>
		<div class="galleryAuthor" style="padding-left:10px; padding-bottom:5px;">Presenti: 
			<b><xsl:value-of select="@liveppl"/></b>
		</div>
		<xsl:choose>
			<xsl:when test='@authlevel &gt; 0'>
				<div class="galleryAuthor" style="padding-left:10px; padding-bottom:5px;">Sei dello staff, <a style="text-decoration: underline;" href="/gallery/loadpics.aspx?gid={@gid}"><b>Edit</b></a></div>
			</xsl:when>
			<xsl:when test='@isowner=1'>
				<div class="galleryAuthor" style="padding-left:10px; padding-bottom:5px;">Sei l'autore, <a style="text-decoration: underline;" href="/gallery/loadpics.aspx?gid={@gid}"><b>Edit</b></a></div>
			</xsl:when>
			<xsl:otherwise>
			</xsl:otherwise>
		</xsl:choose>
<!--
		<div class="galleryAuthor" style="padding-left:10px; padding-bottom:10px;">Autore: 
			<nobr>
			<xsl:call-template name="user">
			<xsl:with-param name="status" select="@uStatus"/>
			<xsl:with-param name="sexid" select="@sexid"/>
			<xsl:with-param name="certified" select="@certified"/>
			<xsl:with-param name="userid" select="@userid"/>
			<xsl:with-param name="nick" select="@nick"/>
			<xsl:with-param name="bold" select="0"/>
			<xsl:with-param name="buddy" select="0"/>
			<xsl:with-param name="newbie" select="0"/>
			</xsl:call-template>
			</nobr>
		</div>
!-->
		<div style="padding-top:5px; padding-left:10px; padding-bottom:10px; padding-right:10px; float:left;">
			<xsl:choose>
				<xsl:when test='@openingsmall and string-length(@opening) = 0'>
					<img border="0" src="http://imgs.goparty.it/gallery/small/{@openingsmall}"/><br/>
				</xsl:when>
				<xsl:when test='@openingsmall'>
					<img border="0" src="http://imgs.goparty.it/gallery/opening/{@openingsmall}"/><br/>
				</xsl:when>
				<xsl:otherwise>
					<img src="http://imgs.goparty.it/gallery/empty.gif"/>
				</xsl:otherwise>
			</xsl:choose>
		</div>
		<div style="padding-top:5px; padding-left:10px; padding-bottom:10px;">
				<xsl:call-template name="lf2br">
				<xsl:with-param name="text" select="@descr"/>
				</xsl:call-template>
			<div class="galleryAuthor" style="padding-top:5px;"> 
				(<xsl:value-of select="substring(@duedate,9,2)"/>/<xsl:value-of select="substring(@duedate,6,2)"/>/<xsl:value-of select="substring(@duedate,1,4)"/>)
			</div>
		</div>

<div style="clear:left;height:10px;"><hr/>
</div>

		<xsl:variable name="cols" select="4"/>
		<table border="0" width="100%" style="margin-top:10px;">
			<xsl:for-each select="picture[(position() mod $cols) = 1]"> 
			<xsl:sort select="pid"/>
				<tr> 
				<xsl:for-each select=".|following-sibling::picture[position() &lt; $cols]"> 
					<xsl:variable name="thispid" select="@pid"/>
					<td class="b10b" align="center" style="padding-bottom:15px;" valign="baseline">
						<a href="/gallery/galleryShow.aspx?gid={/galleryEntry/@gid}&amp;pid={@pid}" class="body"><img border="0" src="http://imgs.goparty.it/gallery/thumb/{@picname}"/></a>
						<div style="border:1px dotted gray; background-color:acqua; margin-top:10px; width:80%;">
						<xsl:choose>
							<xsl:when test='count(/galleryEntry/comment[ @pid = $thispid ]) = 0'>
								<a href="/gallery/galleryShow.aspx?gid={/galleryEntry/@gid}&amp;pid={@pid}" style="color:gray;" class="body"><xsl:value-of select="count(/galleryEntry/comment[ @pid = $thispid ])"/> commenti</a>
							</xsl:when>
							<xsl:when test='count(/galleryEntry/comment[ @pid = $thispid ]) = 1'>
								<a href="/gallery/galleryShow.aspx?gid={/galleryEntry/@gid}&amp;pid={@pid}" class="body"><xsl:value-of select="count(/galleryEntry/comment[ @pid = $thispid ])"/> commento</a>
							</xsl:when>
							<xsl:otherwise>
								<a href="/gallery/galleryShow.aspx?gid={/galleryEntry/@gid}&amp;pid={@pid}" class="body"><xsl:value-of select="count(/galleryEntry/comment[ @pid = $thispid ])"/> commenti</a>
							</xsl:otherwise>
						</xsl:choose>
						<br/>
						<xsl:choose>
							<xsl:when test='@wt &gt; 0'>
								rating: <span class="body10red"><xsl:value-of select="format-number( @vt div @wt, '0.##')"/></span>
							</xsl:when>
							<xsl:otherwise>
								rating: <a style="font-weight:bold;" href="/gallery/galleryShow.aspx?gid={/galleryEntry/@gid}&amp;pid={@pid}" class="body10red">nessuno</a>
							</xsl:otherwise>
						</xsl:choose>
						</div>
					</td> 
				</xsl:for-each> 
				</tr> 
			</xsl:for-each> 
		</table>

</xsl:template>



<xsl:template match="galleryEntry[@activityid &lt; 0]">

<xsl:choose>
	<xsl:when test='@needpwd = 1'>
	<form method="post">
		<div>
		<div style="padding-bottom:5px;">Inserisci la password</div>
			<input type="hidden" ID="gid" name="gid" value="{@gid}"></input>
			<input type="password" ID="photopwd" name="photopwd" size="20" maxlength="20"></input>
			<input type="submit" ID="submit" name="submit" value="Invia"></input>
		</div>
	</form>
	</xsl:when>
	<xsl:otherwise>
		<div class="galleryTitle" style="padding-bottom:5px;"><b><xsl:value-of select="@title"/></b></div>
		<div class="galleryAuthor" style="padding-left:10px; padding-bottom:15px;">Autore: 
			<nobr>
			<xsl:call-template name="user">
			<xsl:with-param name="status" select="@uStatus"/>
			<xsl:with-param name="sexid" select="@sexid"/>
			<xsl:with-param name="certified" select="@certified"/>
			<xsl:with-param name="userid" select="@userid"/>
			<xsl:with-param name="nick" select="@nick"/>
			<xsl:with-param name="bold" select="0"/>
			<xsl:with-param name="buddy" select="0"/>
			<xsl:with-param name="newbie" select="0"/>
			</xsl:call-template>
			</nobr>
		</div>
		<div style="padding-left:10px; padding-bottom:10px; padding-right:10px; float:left;">
			<xsl:choose>
				<xsl:when test='@openingsmall and string-length(@opening) = 0'>
					<img border="0" src="http://imgs.goparty.it/gallery/small/{@openingsmall}"/><br/>
				</xsl:when>
				<xsl:when test='@openingsmall'>
					<img border="0" src="http://imgs.goparty.it/gallery/opening/{@openingsmall}"/><br/>
				</xsl:when>
				<xsl:otherwise>
					<img src="http://imgs.goparty.it/gallery/empty.gif"/>
				</xsl:otherwise>
			</xsl:choose>
		</div>
		<div style="padding-left:10px; padding-bottom:10px;">
				<xsl:call-template name="lf2br">
				<xsl:with-param name="text" select="@descr"/>
				</xsl:call-template>
			<div class="galleryAuthor" style="padding-top:5px;"> 
				(<xsl:value-of select="substring(@duedate,9,2)"/>/<xsl:value-of select="substring(@duedate,6,2)"/>/<xsl:value-of select="substring(@duedate,1,4)"/>)
			</div>
		</div>
		<xsl:if test="@isowner=1">
			<xsl:choose>
				<xsl:when test='@openingsmall'>
					<div class="galleryAuthor">Sei l'autore, <a style="text-decoration: underline;" href="/gallery/loadpics.aspx?gid={@gid}"><b>Edit</b></a></div>
				</xsl:when>
				<xsl:when test='@opening'>
					<a href="/gallery/loadpics.aspx?gid={@gid}&amp;edit=1"><b>Edit</b></a>
				</xsl:when>
				<xsl:otherwise>
					<a href="/gallery/loadpics.aspx?gid={@gid}"><b>Edit</b></a>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:if>

		<xsl:variable name="cols" select="4"/>
		<table border="0" width="100%" style="clear:left; margin-top:10px;">
			<xsl:for-each select="picture[(position() mod $cols) = 1]"> 
			<xsl:sort select="pid"/>
				<tr> 
				<xsl:for-each select=".|following-sibling::picture[position() &lt; $cols]"> 
					<xsl:variable name="thispid" select="@pid"/>
					<td class="b10b" align="center" style="padding-bottom:15px;" valign="baseline">
						<a href="/gallery/galleryShow.aspx?gid={/galleryEntry/@gid}&amp;pid={@pid}" class="body"><img border="0" src="http://imgs.goparty.it/gallery/thumb/{@picname}"/></a>
						<div style="border:1px dotted gray; background-color:acqua; margin-top:10px; width:80%;">
						<xsl:choose>
							<xsl:when test='count(/galleryEntry/comment[ @pid = $thispid ]) = 0'>
								<a href="/gallery/galleryShow.aspx?gid={/galleryEntry/@gid}&amp;pid={@pid}" style="color:gray;" class="body"><xsl:value-of select="count(/galleryEntry/comment[ @pid = $thispid ])"/> commenti</a>
							</xsl:when>
							<xsl:when test='count(/galleryEntry/comment[ @pid = $thispid ]) = 1'>
								<a href="/gallery/galleryShow.aspx?gid={/galleryEntry/@gid}&amp;pid={@pid}" class="body"><xsl:value-of select="count(/galleryEntry/comment[ @pid = $thispid ])"/> commento</a>
							</xsl:when>
							<xsl:otherwise>
								<a href="/gallery/galleryShow.aspx?gid={/galleryEntry/@gid}&amp;pid={@pid}" class="body"><xsl:value-of select="count(/galleryEntry/comment[ @pid = $thispid ])"/> commenti</a>
							</xsl:otherwise>
						</xsl:choose>
						<br/>
						<xsl:choose>
							<xsl:when test='@wt &gt; 0'>
								rating: <span class="body10red"><xsl:value-of select="format-number( @vt div @wt, '0.##')"/></span>
							</xsl:when>
							<xsl:otherwise>
								rating: <a style="font-weight:bold;" href="/gallery/galleryShow.aspx?gid={/galleryEntry/@gid}&amp;pid={@pid}" class="body10red">nessuno</a>
							</xsl:otherwise>
						</xsl:choose>
						</div>
					</td> 
				</xsl:for-each> 
				</tr> 
			</xsl:for-each> 
		</table>

	</xsl:otherwise>
</xsl:choose>

</xsl:template>

<xsl:template match="picture">
	<div style="position: relative; padding: 10px; left: 10px; top: 10px; float: left;">
	<a href="http://imgs.goparty.it/gallery/splash/{@picname}" target="new" class="body"><img border="0" src="http://imgs.goparty.it/gallery/thumb/{@picname}"/></a>
	</div>
</xsl:template>


</xsl:stylesheet>